﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HuiGuanTFSH.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS.ShouFeiGL.HuiGuanTFSH"  Theme="Default"%>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>回灌退费审核</title>
    <script src="../../../../JS/jquery.js" type="text/javascript"></script>
    <script src="../../../../JS/AddEditCancel.js" type="text/javascript"></script>
    <script src="../../../../../PageJS/wap.js"></script>
   <%-- <link href="../../../../css/inputBgColor.css" rel="stylesheet" />--%>
    <style type="text/css">
        body, html {
            padding: 0;
            margin: 0;
            font-size: 12px;
        }

        #img table tr td div {
            cursor: pointer;
        }
        .FloatLeft { float: left; }
        .FloatRight { float: right; }
        .HideWork { display: none; }
    </style>
    <script type="text/javascript">

        function DealWork(op, id) {
            hdCollection.Set("ID", id);
            ASPxCallback1.PerformCallback(op);
        }

        function save() {
            //if (cobGLDW.GetText() == "") {
            //    alert("管理单位，不能为空！");
            //    cobGLDW.Focus();
            //    return;
            //}
            ASPxCallback1.PerformCallback("save");
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            if (type == "Approve" || type == "Return") {
                gvList.PerformCallback();
            }
        }
        //function ChangeChild() {
        //    if (gvGridTab2.GetFocusedRowIndex() != -1) {
        //        hdCollection.Set("gvGrid2Tab2YHH", gvGridTab2.GetRowKey(gvGridTab2.GetFocusedRowIndex()));
        //        //loadpanel1.Show();
        //        gvGrid2Tab2.PerformCallback();
        //    }
        //}

        function begincall() {
            loadpanel1.Show();
        }
        function endcall() {
            loadpanel1.Hide();
            //定位添加或修改的记录
            var oid = hdCollection.Get("OperateID");
            var index = -1;
            if (oid != -1 && typeof (oid) != undefined) {
                for (var i = 0; i < gvList.GetVisibleRowsOnPage() ; i++) {
                    if (gvList.GetRowKey(i) == oid) {
                        index = i;
                    }
                }
                if (index != -1) {
                    gvList.SetFocusedRowIndex(index);
                    gvList.MakeRowVisible(index);
                    hdCollection.Set("OperateID", -1);
                }
            }
        }

        function print(yhh) {
            var params = new Array();
            params.push("V_ID:" + yhh);
            params.push("V_OP:" + "99999");
            params.push("V_SLY:" + cmbYear.GetText());
            params.push("V_SLM:" + cmbMonth.GetValue());
            params.push("V_DAYINRQ:" + txtPrintDate.GetText());
            wap.common.printjx('ZhangDanDY',
                [
                    { key: 'QUERYPARAM', value: params.join("|") },
                    { key: 'BAOBIAOID', value: "120007" },
                    { key: 'USERINFO', value: "csms" }
                ]);
        }

    </script>
</head>
<body style="scroll:none">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            回灌退费审核
        </div>
        <div style="display: none;">
            <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
            <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
         <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="loadpanel1" runat="server" ContainerElementID="gvList" Modal="true" Theme="Metropolis" ShowImage="false" Text="加载中" ></dx:ASPxLoadingPanel> 
        </div>

        <asp:UpdatePanel ID="updatePanel1" runat="server">
            <ContentTemplate>
                <div style="width:100%;">
                    <div>
                    <table style=" height: 35px">
                        <tr>

                            <td align="right" style="min-width: 80px;">水量年月：</td>
                            <td style="width: 120px;">
                                <asp:Panel runat="server" ID="Panel7">
                                    <dx:ASPxComboBox runat="server" ID="cmbYear" Width="100%">
                                    </dx:ASPxComboBox>
                                </asp:Panel>
                            </td>
                            <td style="width: 100px;">
                                <asp:Panel runat="server" ID="Panel1">
                                    <dx:ASPxComboBox runat="server" ID="cmbMonth" Width="100%">
                                        <Items>
                                            <dx:ListEditItem Text="全部" Value="0" />
                                            <dx:ListEditItem Text="一月" Value="1" />
                                            <dx:ListEditItem Text="二月" Value="2" />
                                            <dx:ListEditItem Text="三月" Value="3" />
                                            <dx:ListEditItem Text="四月" Value="4" />
                                            <dx:ListEditItem Text="五月" Value="5" />
                                            <dx:ListEditItem Text="六月" Value="6" />
                                            <dx:ListEditItem Text="七月" Value="7" />
                                            <dx:ListEditItem Text="八月" Value="8" />
                                            <dx:ListEditItem Text="九月" Value="9" />
                                            <dx:ListEditItem Text="十月" Value="10" />
                                            <dx:ListEditItem Text="十一月" Value="11" />
                                            <dx:ListEditItem Text="十二月" Value="12" />
                                        </Items>
                                    </dx:ASPxComboBox>
                                </asp:Panel>
                            </td>
                            <td Width="30px"></td>
                            <td>
                                <dx:ASPxRadioButtonList ID="rblWorktype" runat="server" RepeatColumns="3" SelectedIndex="0" Width="220px" AutoPostBack="True" OnSelectedIndexChanged="btnChaXun_Click">
                                    <Items>
                                        <dx:ListEditItem Selected="True" Text="申请" Value="0" />
                                        <dx:ListEditItem Text="已审批" Value="1" />
                                    </Items>
                                </dx:ASPxRadioButtonList>
                            </td>
                            <td Width="30px"></td>
                            <td align="right" style="min-width: 80px;">用户号：</td>
                            <td>
                                <asp:Panel runat="server" ID="Panel2">
                                    <dx:ASPxTextBox ID="txtYonghuh" runat="server" Width="120px"></dx:ASPxTextBox>
                                </asp:Panel>
                            </td>
                            <td Width="30px"></td>
                            <td style="width: 80px">
                                <dx:ASPxLoadingPanel runat="server" ID="LoadPanel11" ClientInstanceName="LoadPanel" Text="正在查询"></dx:ASPxLoadingPanel>
                                <dx:ASPxButton runat="server" ID="btnChaXun" Text="查询" OnClick="btnChaXun_Click" UseSubmitBehavior="false">
                                    <ClientSideEvents Click="function(s,e){LoadPanel.Show();}" />
                                </dx:ASPxButton>

                            </td>
                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                        </tr>
                    </table>
                    </div>
                   

                    <div style="border: 1px solid #d0e4fe;">
                        <div id="img">
                            <table style="width:100%;">
                                <tr>
                                    <td style="width:60%;text-align:left;">
                                    </td>
                                    <td style="width:10%;text-align:right">
                                        <dx:ASPxLabel ID="zjl" Text="共0条" runat="server" ForeColor="Blue"></dx:ASPxLabel>
                                    </td>
                                    <td style="width:10%;text-align:right">
                                        <dx:ASPxButton ID="btnToExcel" runat="server" Text="导出Excel">
                                            <ClientSideEvents Click="function(s,e){btnExport.OnClick();}"/>
                                        </dx:ASPxButton>
                                    </td>
                                    <td style="width: 150px; text-align: right" >&nbsp;&nbsp;&nbsp;打印日期：</td>
                                    <td style="width: 100px"><dx:ASPxDateEdit runat="server" ID="txtPrintDate" Width="100"></dx:ASPxDateEdit></td>
                                     <td style="float:right; text-align: right">
                                        <dx:ASPxButton ID="btnPrint" runat="server" Text="批量打印">
                                            <ClientSideEvents Click="function(s,e){print(0);}"/>
                                        </dx:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div id="divList">
                            <dx:ASPxGridView ID="gvList" SettingsBehavior-AllowSort="true" ClientInstanceName="gvList" runat="server" AutoGenerateColumns="False" KeyFieldName="S_YONGHUH"
                                ClientIDMode="AutoID"  Width="100%"  OnCustomCallback="gvList_CustomCallback" >
                              
                                <Columns>
                                    <dx:GridViewDataTextColumn Width="70px" FixedStyle="Left">
                                        <DataItemTemplate>
                                            <a href="#" onclick="DealWork('Approve','<%#Eval("S_YONGHUH")%>')"
                                                class="<%#Convert.ToInt32(Eval("I_TYPE")) == 0 ? "" : "HideWork"%>">审批</a>
                                            <a href="#" onclick="DealWork('Return','<%#Eval("S_YONGHUH")%>')"
                                                class="<%#Convert.ToInt32(Eval("I_TYPE")) == 0 ? "" : "HideWork"%>">退回</a>
                                            <a href="#" onclick="print('<%#Eval("S_YONGHUH")%>')"
                                                class="<%#Convert.ToInt32(Eval("I_TYPE")) == 1 ? "" : "HideWork"%>">打印</a>
                                        </DataItemTemplate>
                                        <FooterTemplate><span>合计</span></FooterTemplate>
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_YM" Caption="水量年月" Width="70" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="70" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="200" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_TIME" Caption="退费次数" Width="70" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_HUIGUANL" Caption="总回灌量（M³）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_TF" Caption="已退回灌量（M³）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_HUIGUANL_UN" Caption="未退回灌量（M³）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_HUIGUANL_MR" Caption="多退回灌量（M³）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="I_SQL" Caption="退费水量（M³）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="N_HUIGUANDJ" Caption="回灌单价（元）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="N_TUIFEI_S" Caption="退费金额（元）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="N_TUIFEI_Z" Caption="预退费金额（元）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="N_TUIFEI_W" Caption="未退费金额（元）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="N_TUIFEI_Y" Caption="已退费金额（元）" Width="120" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_KAIHUH" Caption="银行账号" Width="150" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_KAIHUYH" Caption="开户银行" Width="150" HeaderStyle-HorizontalAlign="Center">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                                
                                <Settings VerticalScrollBarMode="Visible" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="300" ShowFooter="True" />
                                <SettingsPager Mode="EndlessPaging" PageSize="100" />
                                <SettingsBehavior AllowFocusedRow="True"  ColumnResizeMode="Control" />
                                <ClientSideEvents Init="function(s,e){AdjustSize(150,gvList);}" BeginCallback="function(s,e){begincall();}" EndCallback="function(s,e){endcall();}" />
                                <TotalSummary>
                                    <dx:ASPxSummaryItem FieldName="I_HUIGUANL" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="I_TF" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="I_HUIGUANL_UN" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="I_SQL" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="N_TUIFEI_W" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="N_TUIFEI_Y" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="N_TUIFEI_S" SummaryType="Sum" DisplayFormat="{0}" />
                                    <dx:ASPxSummaryItem FieldName="N_TUIFEI_Z" SummaryType="Sum" DisplayFormat="{0}" />
                                </TotalSummary>
                            </dx:ASPxGridView>
                        </div>

                    </div>

                </div>

            </ContentTemplate>
        </asp:UpdatePanel>

         <div style="display: none;">
            <dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server"></dx:ASPxGridViewExporter>
            <dx:ASPxButton ID="btnExport" runat="server" ClientInstanceName="btnExport" Text="导出EXCEL" OnClick="btnExport_Click" UseSubmitBehavior="false">
            </dx:ASPxButton>
        </div>   
    </form>
</body>
</html>
